package modelo;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import entities.MovimientoEntity;
import entities.OrdenCompraEntity;
import hbt.AbstractHibernateManager;

public class MovimientoDao extends AbstractHibernateManager {

	public void save (MovimientoEntity movi){
		Session s = null;
		try {
			s=getNewSession();
			s.beginTransaction();
			s.persist(movi);
			s.flush();
			s.getTransaction().commit();
			System.out.println("[OrdenesCompra PERSISTED ON TABLE Movimientos]::OK");
		} catch (HibernateException e) {
			e.printStackTrace();
		} finally{
			closeSession(s);
		}
	}
	
	
	public void guardar (MovimientoEntity movi){
		Session s = null;
		try {
			s=getNewSession();
			s.beginTransaction();
			s.save(movi);
			s.flush();
			s.getTransaction().commit();
			System.out.println("[OrdenesCompra SAVED ON TABLE Movimientos]::OK");
		} catch (HibernateException e) {
			e.printStackTrace();
		} finally{
			closeSession(s);
		}
	}
	
}
